package com.indusfo.spc.controller;

import com.indusfo.spc.pojo.BatchRepairDete;
import com.indusfo.spc.service.BatchRepairDeteService;
import com.indusfo.spc.vo.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

/**
 * @Author liub
 * @Date 2019/12/6 13:22
 * @Version 1.0
 */

@Controller
@RequestMapping("/service/batchRepairDete")
public class BatchRepairDeteController {

    @Autowired
    private BatchRepairDeteService batchRepairDeteService;

    /**
     * 查询
     */
    @RequestMapping(value = "/queryBatchRepairDete")
    @ResponseBody
    public JSONObject queryBatchRepairDete(BatchRepairDete batchRepairDete) {
        JSONObject json = batchRepairDeteService.queryBatchRepairDete(batchRepairDete);
        return json;
    }

    /**
     * 新增
     */
    @RequestMapping(value = "/insertBatchRepairDete", method = RequestMethod.POST)
    @ResponseBody
    public JSONObject insertBatchRepairDete(BatchRepairDete batchRepairDete) {
        JSONObject json = batchRepairDeteService.insertBatchRepairDete(batchRepairDete);
        return json;
    }

    /**
     * 修改
     */
    @RequestMapping(value = "/updateBatchRepairDete", method = RequestMethod.POST)
    @ResponseBody
    public JSONObject updateBatchRepairDete(BatchRepairDete batchRepairDete) {
        JSONObject json = batchRepairDeteService.updateBatchRepairDete(batchRepairDete);
        return json;
    }

    /**
     * 删除
     */
    @RequestMapping(value = "/deleteBatchRepairDete", method = RequestMethod.POST)
    @ResponseBody
    public JSONObject deleteBatchRepairDete(@RequestParam("batchRepairDeteIds") List<Integer> batchRepairDeteIds, Integer dataState) {
        dataState = 2;
        JSONObject json = batchRepairDeteService.deleteBatchRepairDete(batchRepairDeteIds, dataState);
        return json;
    }

    /**
     * 启停
     */
    @RequestMapping(value = "/definedBatchRepairDete", method = RequestMethod.POST)
    @ResponseBody
    public JSONObject definedBatchRepairDete(@RequestParam("batchRepairDeteIds") List<Integer> batchRepairDeteIds, Integer dataState) {
        JSONObject json = batchRepairDeteService.deleteBatchRepairDete(batchRepairDeteIds, dataState);
        return json;
    }

}
